﻿using System;
using System.Linq;

namespace ebc.patterns.rx.pins
{
    public class InputPin<T> : IObserver<T>
    {
        private readonly IObserver<T> observer;


        public InputPin(Action<T> processor)
        {
            this.observer = Observer.Create(processor);
        }

        public InputPin(IObserver<T> observer)
        {
            this.observer = observer;
        }


        public void OnNext(T value)
        {
            this.observer.OnNext(value);
        }

        public void OnError(Exception error)
        {
            this.observer.OnError(error);
        }

        public void OnCompleted()
        {
            this.observer.OnCompleted();
        }
    }
}
